]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
padOsd: Ensure to pick pad devices only
authorCarlos Garnacho <carlosg@gnome.org>
Fri, 19 Jan 2018 09:45:50 +0000 (10:45 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Tue, 30 Jan 2018 15:19:42 +0000 (16:19 +0100)
If the underlying X11 input driver creates multiple devices from a single
device node, we may end up picking up the wrong device. So, instead of
picking the first device based on node and bailing out if it's not a pad,
pick the first pad that has that device node, and bail out if there is
none.

https://gitlab.gnome.org/GNOME/gnome-shell/issues/10

Closes: #10
js/ui/padOsd.js

index 34ef96bb9cd7c6876bf3be5ec94bc0db7f3e37db..49d36e6dcfb8df41bf91a83301561d7c759b61fb 100644 (file)
@@ -977,12 +977,12 @@ var PadOsdService = new Lang.Class({
         let padDevice = null;
 
         devices.forEach(Lang.bind(this, function(device) {
-            if (deviceNode == device.get_device_node())
+            if (deviceNode == device.get_device_node() &&
+                padDevice.get_device_type() == Clutter.InputDeviceType.PAD_DEVICE)
                 padDevice = device;
         }));
 
-        if (padDevice == null ||
-            padDevice.get_device_type() != Clutter.InputDeviceType.PAD_DEVICE) {
+        if (padDevice == null) {
             invocation.return_error_literal(Gio.IOErrorEnum,
                                             Gio.IOErrorEnum.CANCELLED,
                                             "Invalid params");